package com.ddogring.business.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @BelongsProject: eshop
 * @BelongsPackage: com.ddogring.business.domain
 * @Author: DdogRing
 * @CreateTime: 2023-01-30  10:23
 * @Description: TODO
 * @Version: 1.0
 */
@Data
@TableName("t_comment")
public class Comment {

    /** 主键 */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /** 评论内容 */
    @NotBlank(message = "评论内容不能为空")
    private String content;

    /** 商品id */
    @NotNull(message = "商品id不能为空")
    private Integer commodityId;

    /** 评论人 */
    @NotNull(message = "评论人id不能为空")
    private Integer userId;

    /** 评价人用户名 */
    @TableField(exist = false)
    private String username;

    /** 点赞数 */
    private Integer support;

    /** 1好评 2中评 3差评 */
    private Integer status;

    /** 5颗星星 12差评 34中评 5好评 */
    private Integer star;

    /** 0未删除 1已删除 */
    @TableLogic(value = "0", delval = "1")
    @TableField(fill = FieldFill.INSERT)
    private Integer delFlag;

    /** 创建时间 */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 修改时间 */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 好评率 */
    @TableField(exist = false)
    private Double goodAnalyse;

    /** 好评数量 */
    @TableField(exist = false)
    private Integer high;

    /** 中评数量 */
    @TableField(exist = false)
    private Integer middle;

    /** 差评数量 */
    @TableField(exist = false)
    private Integer low;
}
